// 搜索历史记录的 键名称
const HMTT_HISTORY = 'HMTT_HISTORY'
const HMTT_MANAGE = 'HMTT_MANAGE'

// 设置历史记录
export const setHistory = (array) =>
  localStorage.setItem(HMTT_HISTORY, JSON.stringify(array))

// 获取历史记录
export const getHistory = () =>
  JSON.parse(localStorage.getItem(HMTT_HISTORY)) || []

// 清空历史记录
export const removeHistory = () => localStorage.removeItem(HMTT_HISTORY)

// 设置栏目数据，包含选中栏目和未选中栏目
export const setManage = (object) =>
  localStorage.setItem(HMTT_MANAGE, JSON.stringify(object))

// 获取栏目数据，包含选中栏目和未选中栏目
export const getManage = () =>
  JSON.parse(localStorage.getItem(HMTT_MANAGE)) || {}
